UpdatableStatesMachine

interface UpdatableStatesMachine<T : State> : StatesMachine<T>

This extender of StatesMachine interface declare one new function updateChain. Realizations of this interface must be able to perform update of chain in internal StatesManager

Functions

Link copied to clipboard
abstract suspend fun StatesMachine<in T>.handleState(state: T): T?

Main handling of state. In case when this state leads to another State and handleState returns not null State it is assumed that chain is not completed.

Link copied to clipboard
open suspend fun launchStateHandling(state: T, handlers: List<CheckableHandlerHolder<in T, T>>): T?
Link copied to clipboard
abstract fun start(scope: CoroutineScope): Job

Starts handling of States

Link copied to clipboard
abstract suspend fun startChain(state: T)

Start chain of States witn state

Link copied to clipboard
abstract suspend fun updateChain(currentState: T, newState: T)

Update chain with current state equal to currentState with newState. Behaviour of this update preforming in cases when currentState does not exist in StatesManager must be declared inside of realization of StatesManager.update function

Inheritors

DefaultUpdatableStatesMachine
Link copied to clipboard